package edu.kpi.pzks2.statistics;

import edu.kpi.pzks2.graph.Edge;
import edu.kpi.pzks2.graph.Node;
import edu.kpi.pzks2.ui.task.TaskFrame.QueueType;
import edu.kpi.pzks2.ui.task.TaskFrame.StrategyType;
import edu.uci.ics.jung.graph.Graph;

/**
 * Input data for the statistics module.
 *
 * @author Pustovit Michael, pustovitm@gmail.com
 */
public class StatisticsBundle {
    private Graph<Node, Edge> system;
    
    private float minConnectivity;
    private float maxConnectivity;
    private float stepConnectivity;
    
    private int minNodeCount;
    private int maxNodeCount;
    private int stepNodeCount;
    
    private int minNodeWeight;
    private int maxNodeWeight;
    
    private int minEdgeWeight;
    private int maxEdgeWeight;
    
    private int seriesSize;
    
    private boolean [] duplexModes = {false};
    
    private int minChannelCount;
    private int maxChannelCount;
    private int stepChannelsCount;
    
    private int minPerformance;
    private int maxPerformance;
    private int stepPerformance;
    
    private int minSpeed;
    private int maxSpeed;
    private int stepSpeed;
    
    private QueueType[] queueBuilders;
    private StrategyType [] strategyFactories;
    
    private StatisticsBundle() {
        minConnectivity = 0.1f;
        maxConnectivity = 1.0f;
        stepConnectivity = 0.1f;
        
        minNodeCount = 9;
        maxNodeCount = 9;
        stepNodeCount = 1;
        
        minNodeWeight = 1;
        maxNodeWeight = 5;
        
        minEdgeWeight = 1;
        maxEdgeWeight = 5;
        
        seriesSize = 30;
        
        minChannelCount = 1;  
        maxChannelCount = 1;  
        stepChannelsCount = 1;
                              
        minPerformance = 1;   
        maxPerformance = 1;   
        stepPerformance = 1;  
                              
        minSpeed = 1;         
        maxSpeed = 1;         
        stepSpeed = 1;        
        
        queueBuilders = new QueueType [0];
        strategyFactories = new StrategyType [0];
    }
    
    public static class StatisticsBundleBuilder {
        private final StatisticsBundle res;
        
        public StatisticsBundleBuilder() {
            res = new StatisticsBundle();
        }
        
        public void setSystem(Graph<Node, Edge> system) {
            res.system = system;
        }

        public void setMinConnectivity(float minConnectivity) {
            res.minConnectivity = minConnectivity;
        }

        public void setMaxConnectivity(float maxConnectivity) {
            res.maxConnectivity = maxConnectivity;
        }

        public void setStepConnectivity(float stepConnectivity) {
            res.stepConnectivity = stepConnectivity;
        }

        public void setMinNodeCount(int minNodeCount) {
            res.minNodeCount = minNodeCount;
        }

        public void setMaxNodeCount(int maxNodeCount) {
            res.maxNodeCount = maxNodeCount;
        }

        public void setStepNodeCount(int stepNodeCount) {
            res.stepNodeCount = stepNodeCount;
        }

        public void setMinNodeWeight(int minNodeWeight) {
            res.minNodeWeight = minNodeWeight;
        }

        public void setMaxNodeWeight(int maxNodeWeight) {
            res.maxNodeWeight = maxNodeWeight;
        }

        public void setMinEdgeWeight(int minEdgeWeight) {
            res.minEdgeWeight = minEdgeWeight;
        }

        public void setMaxEdgeWeight(int maxEdgeWeight) {
            res.maxEdgeWeight = maxEdgeWeight;
        }

        public void setQueueBuilders(QueueType[] queueBuilders) {
            res.queueBuilders = queueBuilders;
        }

        public void setStrategyFactories(StrategyType[] strategyFactories) {
            res.strategyFactories = strategyFactories;
        }

        public void setSeriesSize(int seriesSize) {
            res.seriesSize = seriesSize;
        }
        
    	public void setDuplexModes(boolean[] duplexModes) {
    		res.duplexModes = duplexModes;
    	}

    	public void setMinChannelCount(int minChannelCount) {
    		res.minChannelCount = minChannelCount;
    	}

    	public void setMaxChannelCount(int maxChannelCount) {
    		res.maxChannelCount = maxChannelCount;
    	}

    	public void setStepChannelsCount(int stepChannelsCount) {
    		res.stepChannelsCount = stepChannelsCount;
    	}

    	public void setMinPerformance(int minPerformance) {
    		res.minPerformance = minPerformance;
    	}

    	public void setMaxPerformance(int maxPerformance) {
    		res.maxPerformance = maxPerformance;
    	}

    	public void setStepPerformance(int stepPerformance) {
    		res.stepPerformance = stepPerformance;
    	}

    	public void setMinSpeed(int minSpeed) {
    		res.minSpeed = minSpeed;
    	}

    	public void setMaxSpeed(int maxSpeed) {
    		res.maxSpeed = maxSpeed;
    	}

    	public void setStepSpeed(int stepSpeed) {
    		res.stepSpeed = stepSpeed;
    	}

        public StatisticsBundle build() {
            return res;
        }
    }
    
    public Graph<Node, Edge> getSystem() {
        return system;
    }

    public float getMinConnectivity() {
        return minConnectivity;
    }

    public float getMaxConnectivity() {
        return maxConnectivity;
    }

    public float getStepConnectivity() {
        return stepConnectivity;
    }

    public int getMinNodeCount() {
        return minNodeCount;
    }

    public int getMaxNodeCount() {
        return maxNodeCount;
    }

    public int getStepNodeCount() {
        return stepNodeCount;
    }

    public int getMinNodeWeight() {
        return minNodeWeight;
    }

    public int getMaxNodeWeight() {
        return maxNodeWeight;
    }

    public int getMinEdgeWeight() {
        return minEdgeWeight;
    }

    public int getMaxEdgeWeight() {
        return maxEdgeWeight;
    }

    public QueueType[] getQueues() {
        return queueBuilders;
    }

    public StrategyType[] getStrategies() {
        return strategyFactories;
    }
    
    public int getSeriesSize() {
        return seriesSize;
    }

	public boolean[] getDuplexModes() {
		return duplexModes;
	}

	public int getMinChannelCount() {
		return minChannelCount;
	}

	public int getMaxChannelCount() {
		return maxChannelCount;
	}

	public int getStepChannelsCount() {
		return stepChannelsCount;
	}

	public int getMinPerformance() {
		return minPerformance;
	}

	public int getMaxPerformance() {
		return maxPerformance;
	}

	public int getStepPerformance() {
		return stepPerformance;
	}

	public int getMinSpeed() {
		return minSpeed;
	}

	public int getMaxSpeed() {
		return maxSpeed;
	}

	public int getStepSpeed() {
		return stepSpeed;
	}

	public QueueType[] getQueueBuilders() {
		return queueBuilders;
	}

	public StrategyType[] getStrategyFactories() {
		return strategyFactories;
	}
    
}
